#include "backManager.h"

backManager::backManager()
{

}

void backManager::updata()
{
	_backGround.updata();
	for (vector<gameLogo*>::iterator itor = _gameLogoManager.begin();
		itor != _gameLogoManager.end();)
	{
		if ((*itor)->checkRemove())
		{
			delete *itor;
			itor = _gameLogoManager.erase(itor);
		}else
		{
			(*itor)->updata();
			itor++;
		}
	}
}

void backManager::draw()
{
	_backGround.draw();
	for (vector<gameLogo*>::iterator itor = _gameLogoManager.begin();
		itor != _gameLogoManager.end(); itor++)
	{
		(*itor)->draw();
	}
}

void backManager::setGlobalMessage(message* m)
{
	if (m->flag == CHANGEBACKGROUND)
	{
		_backGround.setNowDraw(m->emenyKind);
	}else if (m->flag == SETLOGO)
	{
		_gameLogoManager.push_back(new gameLogo(m->str));
	}
}